package com.study.a02mystreamTest;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class Test3 {
    public static void main(String[] args) {

        ArrayList<String> manlist=new ArrayList<>();
        Collections.addAll(manlist,"蔡徐坤,23","王鑫,24","吴铅,25","王一博,26","肖肖,27");
        ArrayList<String> girllist = new ArrayList<>();
        Collections.addAll(girllist,"赵丽颖,15","杨颖,33","刘诗诗,15","范冰冰,11","高圆圆,12","杨白,13");

        Stream<String> stream1 = manlist.stream()
                .filter(s->s.split(",")[0].length()==3)
                .limit(2);


        Stream<String> stream2=girllist.stream()
                .filter(s->s.split(",")[0].startsWith("杨"))
                .skip(1);


        //合并
        //封装为Actor对象
       List<Actor> list = Stream.concat(stream1,stream2)
                .map(s->new Actor(s.split(",")[0],Integer.parseInt(s.split(",")[1])))
                .collect(Collectors.toList());
        System.out.println(list);
    }
}
